<?php
/**
 * 选择商户组Widget
 */
class SelectPartnerWidget extends Widget {
	
	/**
	 * 选择用户组Widget
	 * 
	 * $data接受的参数:
	 * arrary(
	 * 	'selected_partner_id'(可选) => $selected_partner_id, // 已选中的商户ID(默认为空)
	 * 	'select_id_val'(可选)			 => $select_id_val,			// select_id值
	 * )
	 * 
	 * @see Widget::render()
	 */
	public function render($data) {
			//global $ts;
			$data['selected_partner_id']	= isset($data['selected_partner_id'])	? $data['selected_partner_id']	 : null;
			$data['select_id_val']	= isset($data['select_id_val'])	? $data['select_id_val']	 : null;
			//$data['gparea']	= isset($data['gparea']) ? $data['gparea'] : false;
			//$data['user_groups'] = D('Partner','Admin')->getUserGroupByMap('', 'user_group_id,title');
			//$data['selected']	= array();

			$data['listpartners'] = D('Partner','Admin')->selectAllMainPartners();
			dump($data['listpartners']);
			//根据用户ID获取已选中的用户组
			$content = $this->renderFile(ADDON_PATH . '/widgets/SelectPartner.html', $data);
			return $content;
	}
}